Release 10.1A: OpenEdge Getting Started:
Object-oriented Programming
Using an interface definition
Interfaces cannot be instantiated but they can be used as the data type to define an object reference, such as in a
DEFINEVARIABLEstatement or aDEFINEPARAMETERstatement. The value of the object reference can then be assigned to be an instance of a class that implements the interface. Multiple classes can implement the same interface, which allows the classes to be treated in a common manner. An object reference to an interface can be used to call these common methods even though the underlying objects are of different classes. This is similar to having multiple classes inheriting from the same super class although an interface provides no method implementation. An object reference to the super class can be used to call the methods that are defined in the super class, even though the underlying objects are of different classes.The following example shows a simple interface definition:
This shows part of the sample class definition modified to implement the interface:
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |